﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MySerialization
{
    public class Person
    {
        public int id;
        public string FName;
        public string LName;
        public int Age;

        public string SaveToDB()
        {
            string str = id.ToString() + ":" + FName.ToString() + ":"
                + LName.ToString() + ":" + Age.ToString();

            return str;
        }

        public string SaveToSCV()
        {
            string str = id.ToString() + ";" + FName.ToString() + ";"
                + LName.ToString() + ";" + Age.ToString() + ";";

            return str;
        }

        public void LoadFromCSV(string[] strArray)
        {
            id = Convert.ToInt32(strArray[1]);
            FName = strArray[2];
            LName = strArray[3];
            Age = Convert.ToInt32(strArray[4]);
        }

        public bool compare(Person b)
        {
            bool ret = false;

            if (this.id == b.id && this.FName == b.FName && this.LName == b.LName && this.Age == b.Age)
            {
                ret = true;
            }

            return ret;
        }
    }
}
